<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <link rel="manifest" href="./static/manifest.json">

    <title>宽策略证券</title>
    <style>
      .indextoast{
        display: none;
        position: fixed;
        max-width: 80%;
        border-radius: 5px;
        background: rgba(0, 0, 0, 0.7);
        color: #fff;
        box-sizing: border-box;
        text-align: center;
        z-index: 1000;
        -webkit-transition: opacity .3s linear;
        transition: opacity .3s linear;
        position: absolute;
        top: 50%;
        left: 50%;
        margin-left: -60px;
      }
      @-webkit-keyframes fadeIn {
        0% {
        opacity: 0; /*初始状态 透明度为0*/
        }
        50% {
        opacity: 1; /*中间状态 透明度为0*/
        }
        100% {
        opacity: 0; /*结尾状态 透明度为1*/
        }
      }
      .indextoast{
        -webkit-animation-name: fadeIn; /*动画名称*/
        -webkit-animation-duration: 3s; /*动画持续时间*/
        -webkit-animation-iteration-count: 1; /*动画次数*/
        -webkit-animation-delay: 0s; /*延迟时间*/
      }
      .indextoast p{
        color:#fff;
        padding: 4px 10px;
      }
    </style>
  </head>
  <body>
    <div class="indextoast" id="indexToast">
      <p>再点击一次退出!</p>
    </div>
    <div id="app" class="app"></div>
    <script type="text/javascript" src="cordova.js"></script>
    <script>

      document.addEventListener("deviceready", onDeviceReady, false);
      function onDeviceReady() {
        window.localStorage.setItem('device',JSON.stringify(device))
        document.addEventListener("backbutton", onBackKeyDown, false);//绑定退出事件
        Cordova.exec(cb, err, "CDVIdfa", "advertisingIdentifier", []);
      }
      function onBackKeyDown() {
        document.getElementById('indexToast').style.display = 'block';
        document.removeEventListener("backbutton", onBackKeyDown, false); // 注销返回键
        document.addEventListener("backbutton", exitApp, false);//绑定退出事件
        // 3秒后重新注册
        var intervalID = window.setInterval(function() {
            document.getElementById('indexToast').style.display = 'none';
            window.clearInterval(intervalID);
            document.removeEventListener("backbutton", exitApp, false); // 注销返回键
            document.addEventListener("backbutton", onBackKeyDown, false); // 返回键
        }, 3000);
      }
      function exitApp(){
          navigator.app.exitApp();
      }
      function cb(m) {
        window.localStorage.setItem('device2',JSON.stringify(m))
      }
      function err(m) {
        console.log('Error: '+m);
      }
    </script>
  </body>
</html>
